package com.thoughtworks.tax.strategy;

import java.util.HashMap;
import java.util.Map;

import com.thoughtworks.tax.Item;
import com.thoughtworks.tax.ItemType;

/**
 * Generate the tax strategy
 * @author Tang Ling
 *
 */
public class TaxStrategyFactory
{
	private static Map<ItemType, SalesTaxStrategy>	strategies	= null;
	static
	{
		strategies = new HashMap<ItemType, SalesTaxStrategy>();
		strategies.put(ItemType.IMPORTED_AND_SPECIAL, new ImportedAndSpecialGoodTaxStrategy());
		strategies.put(ItemType.IMPORTED_AND_NON_SPECIAL, new ImportedAndNonSprecialGoodTaxStrategy());
		strategies.put(ItemType.NON_IMPORTED_AND_SPECIAL, new NonImportedAndSpecialGoodTaxStrategy());
		strategies.put(ItemType.NON_IMPORTED_AND_NON_SPECIAL, new NonImportedAndNonSpecialGoodTaxStrategy());

	}

	public static SalesTaxStrategy buildStrategy(Item item)
	{
		return strategies.get(item.getItemType());
	}
}
